<template>
  <div class="search-container" style="margin-top: 10px">
    <div class="container">
      <div class="search">
        <el-input  placeholder="请输入商品名称" v-model="input" clearable></el-input>
        <el-button type="primary" icon="el-icon-search" @click="search">搜索</el-button>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      input: ''
    }
  },
  methods: {
    search() {
      this.$store.state.input = this.input
      if(this.$route.path == '/search') {
        this.$router.push('/searchblock')
      }else{
        this.$router.push('/search')
      }
    }
  }
}
</script>

<style scoped>
.search {
  display: flex;
}
.search .el-input {
  margin-right: 5px;
}
</style>